#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2016/10/27 17:08
# @Author  : xycfree
# @Link    : http://example.org
# @Version : $

import os
from flask import Flask
from flask import request
from flask import abort, redirect, url_for
from flask import render_template
import json
app = Flask(__name__)

@app.route('/')
def index():
	return render_template('upload_demo.html')

@app.route('/upload', methods=['GET', 'POST'])
def upload_file():
	if request.method == 'POST':
		f = request.files['files[]']
		filename = f.filename
		minetype = f.content_type
		f.save('static/' + filename)
		return json.dumps({"files": [{"name": filename, "minetype": minetype}]})
	return render_template('upload_demo.html')
if __name__ == '__main__':
	app.run(host="0.0.0.0", port=7000, debug=True)
